package spring;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;

@Component("myAnotherAdvice")
@Aspect
public class MyAnotherAdvice {
    @Before("execution(* spring.Math.add(..))")
    public void before(){
        System.out.println("----this is my before advice----");
    }
    @After("execution(* spring.Math.subtract(..))")
    public void after(){
        System.out.println("-----this is my after advice-------");
    }
    @Around("execution(* spring.Math.plus(..))")
    public Object invoke(ProceedingJoinPoint jp) throws Throwable {
        System.out.println("---------around advice begin-----------");
        Object object=jp.proceed();
        System.out.println("----------around advice  end------");
        return object;
    }
}
